<script setup>
import { defineProps } from 'vue'
import router from '@/router/index.js'

defineProps({
  experts: {
    type: Array,
    required: true
  }
})
</script>

<template>
  <el-card class="expert-card" shadow="hover">
    <el-row class="card" v-for="expert in experts" :key="expert.uid" @click="router.push(`/expert/detail/${expert.uid}`)">
      <el-col :span="3">
        <div class="head">
          <el-avatar :fit="'cover'"
              :src="expert.expert_avatar"
          />
        </div>
      </el-col>
      <el-col :span="21">
        <div class="info-area">
          <div class="header">
            <h4 class="expert_name">{{expert.name}}</h4>
            <el-button class="btn" size="small" plain>限时免费提问</el-button>
          </div>
          <div class="center">
            <span>{{expert.belong}}</span><br>
            <span>{{expert.descri}}</span>
          </div>
          <div class="footer">
            <span class="ftext">咨询量</span><span class="fnum">{{expert.guidances}}</span>
            <span class="ftext">回复量</span><span class="fnum">{{expert.replies}}</span>
            <span class="ftext">回复率</span><span class="fnum">{{expert.guidances==='0'?0:(100*expert.replies/expert.guidances).toFixed(1)}}%</span>
          </div>
        </div>
      </el-col>
    </el-row>
  </el-card>
</template>

<style scoped lang="less">
.expert-card {
  width: 100%;
  height: auto;
  background-color: white;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
}

.card{
  max-height: 130px;
  min-width: 420px;
  width: auto;
  border: rgba(193, 193, 193, 0.43) 1px solid;
  padding: 10px;
  margin-top: 15px;
}
.card:hover {
  cursor: pointer; //光标变成手
}

.header{
  height: 40px;
}
.head{
  margin-top: 15px;
}
.center{
  font-size: 12px;
  color: #646464;
  height: 40px;
  overflow:hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  -o-text-overflow:ellipsis;
}
.info-area{
  display: grid;
}
.btn{
  float: right;
  margin-top: 15px;
  color: #39bf3e;
  border-color: #39bf3e;
}
.btn:hover{
  background-color: #14c131;
  color:white;
}
.expert_name{
  float: left ;
  margin-top: 15px
}
.expert_name:hover{
  color:#39bf3e;
}

.fnum{
  font-size: 16px;
  font-weight: bold;
  margin-right: 30px;
}
.ftext{
  font-size: 12px;
  color: #909090;
  margin-bottom: 10px;
}

.el-row {
  margin-bottom: 20px;
}
.el-row:last-child {
  margin-bottom: 0;
}
.el-col {
  border-radius: 4px;
}

.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
</style>